<include file="App/Home/View/Public/header.html"/>
	<!--左侧导航 end-->	
	<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">			
		<div class="row">
			<ol class="breadcrumb">
				<li class="active position_tit">服务中心<span style=" padding:0px 5px;">/</span>申请服务中心</li>
			</ol>
		</div><!--/.row-->
		
		<div class="row">
			<div class="col-lg-12">
				<div class="panel panel-default">
					<!--<div class="panel-heading">会员资料</div>-->
					<div class="panel-body">
						<table class="table1">
						    <thead>
						      <tr>
						        <th colspan="2" style=" text-align:center; background-color:#f5f5f5;">申请服务中心</th>
						      </tr>
						    </thead>
                            <tbody>
                              <tr>
                                <td>申请会员编号：</td>
                                <td><input style=" width:300px; margin:0 auto; background-color:#eee;" id="username" class="form-control" value="{$Think.session.USER_KEY}" disabled="disabled"></td>
                              </tr>
                              <tr>
                                <td>申请会员所需金额：</td>
                                <td><input style=" width:300px; margin:0 auto; background-color:#eee;" id="money" class="form-control" value="1000" disabled="disabled"></td>
                              </tr>
                              <tr>
                                <td>负责地区：</td>
								<td id="ci">
									<select class="cid" name="city">
										<option>--请选择--</option>
									</select>
								</td>
                              </tr>
                            </tbody>
						</table>
                        
					</div>
                    <div class="panel-footer">
						<div class="input-group article_btn">
							<span class="input-group-btn">
								<button  id="submit" onClick="submit()" class="btn btn-success btn-md btn_art_return">提交</button>
							</span>
						</div>
                        
					</div>
				</div>
			</div>
		</div><!--/.row-->
        		
	</div>	<!--/.main-->	

<script src="__PUBLIC__/Home/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
	var url = "{:U('Apply/areas')}";
	$.post(url,{'id':1},function(data){
		 for (var i = 0; i < data.length; i++) {
			 var info = "<option value='"+data[i].area_id+"'>"+data[i].area_name+"</option>";
			 $('.cid').append(info);
         };
	})
	$(".cid").live("change",function(){
		 var ob = $(this);
         ob.nextAll("select").remove();
			 $.post(url,{'id':ob.val()},function(data){
				if(data.length>0){
					var select = $("<select class='cid' name='"+ob.val()+"'><option>--请选择--</option></select>");
					for (var i = 0; i < data.length; i++){
						 var info = "<option value='"+data[i].area_id+"'>"+data[i].area_name+"</option>";
						 select.append(info);
					 }
						 ob.after(select);
				 }
			 })
	})
	function submit(){
		var num0 = $('.cid').eq(0).val();
		var num1 = $('.cid').eq(1).val();
		var num2 = $('.cid').eq(2).val();
		var username = $('#username').val();
		var money = $('#money').val();
		var url = "{:U('Apply/submit')}";
		$.post(url,{'money':money,'num0':num0,'num1':num1,'num2':num2,'member_name':username},function(data){
			if(data['status']==1){
				alert(data['info']);
				window.location.href = "{:U('Apply/index')}";
			}else{
				alert(data['info']);			
			}
			
//			console.log(data);
		})
	}
</script>
</html>
